import sys
import os

def gen_ubuntu(path):
    tmp="""Bootstrap:localimage
From: /CLQCD/containers/ubuntu_22.04.sif
%setup
%files
    /opt/containers/sources.list_22.04 /etc/apt/sources.list
%post
    export DEBIAN_FRONTEND=noninteractive
    apt update
    apt install -y build-essential gfortran cmake make autoconf automake
    apt install -y openmpi-bin openmpi-doc libopenmpi-dev
    apt install -y vim 
    apt install -y wget git python3 python3-pip curl ssh openssl libssl-dev
    apt install -y libxml2-dev libxml2
    apt install -y file bzip2
    apt install -y gcc-10 g++-10 gfortran-10
    apt install -y libblas-dev liblapack-dev
    update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 70
    update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 60
    update-alternatives --config gcc
    update-alternatives  --install /usr/bin/g++ g++ /usr/bin/g++-11 70
    update-alternatives  --install /usr/bin/g++ g++ /usr/bin/g++-10 60
    update-alternatives --config g++
    update-alternatives --install /usr/bin/gfortran gfortran /usr/bin/gfortran-11 70
    update-alternatives --install /usr/bin/gfortran gfortran /usr/bin/gfortran-10 60
    update-alternatives --config gfortran
    pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

    mkdir -p /src
    mkdir -p /vopt 
%environment
%runscript
"""
    return tmp

def gen_cuda(cuda_version):
    tmp="""
"""

print(gen_ubuntu("ccc"))